<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta http-equiv="Content-Type">
    <title>快件e栈用户登陆</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body style="">
<%
    Cookie[] cookies = request.getCookies();
    String userPhone = "";
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("userPhone_cookie")) {
                userPhone = cookie.getValue();
                System.out.println("userPhone_cookie已读取！");
                break;
            }
        }
    }
    request.setAttribute("userPhone", userPhone);
    String password = "";
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("password_cookie")) {
                password = cookie.getValue();
                System.out.println("password_cookie已读取！");
                break;
            }
        }
    }
    request.setAttribute("password", password);
%>
<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed">
        <a href="javascript:;" class="aui-navBar-item">

        </a>
        <div class="aui-center">
            <span class="aui-center-title"></span>
        </div>
    </header>
    <section class="aui-scrollView">
        <div class="aui-ver-head">
            <img src="images/head.png" alt="">
        </div>
        <div class="aui-ver-form"><img class="logo" src="images/logo.png">
            <div class="aui-flex">
                <div class="aui-flex-box">
                    <i class="icon icon-phone"></i>
                    <input id="phone1" type="text" autocomplete="off" value="${userPhone}" placeholder="手机号码">
                </div>
            </div>
            <div class="aui-flex">
                <div class="aui-flex-box">
                    <i class="icon icon-code"></i>
                    <input id="code1" type="text" autocomplete="off" value="${password}" placeholder="密码">
                </div>

            </div>
            <div class="aui-ver-button">
                <button onclick="binding()">立即登录</button>
            </div>
            <div class="aui-cell-box">
                <label class="cell-right">
                    <input type="checkbox" value="1" name="checkbox" checked="checked">
                    <i class="cell-checkbox-icon"></i>
                    <em>同意快递e栈注册协议</em>
                </label>
            </div>
            <div class="aui-ver-button">
                <a href="login.html">手机短信验证登录</a>
            </div>
        </div>
    </section>
</section>
<script src="/js/jquery.min.js"></script>
<script src="/admin/layer/layer.js"></script>
<script type="text/javascript">
    function binding() {
        if (!$(":checkbox").prop("checked")) {
            layer.msg("未勾选协议,无法登陆");
            return;
        }
        //alert("正在登陆")
        //window.location.href="index.html";
        var userPhone = $.trim($('#phone1').val());
        var password = $.trim($('#code1').val());
        var windowId = layer.load();
        $.post("wxloginpwd.do", {userPhone: userPhone, password: password}, function (data) {
            layer.close(windowId);
            if (data.status == 0 || data.status == 1) {
                //用户登录成功
                window.location.href = "index.html";
            }
            layer.msg(data.result);
        }, "JSON");
    }
</script>

</body>
</html>